package com.ls.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ls.dto.DishDto;
import com.ls.entity.Dish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author atom.hu
 * @version V1.0
 * @Package com.ls.mapper
 * @date 2021/10/15 11:20
 */
@Mapper
public interface DishMapper extends BaseMapper<Dish> {
    /**
     * 多表分页查询
     * @param page
     * @param ew 该变量名必须叫we，如果不叫ew，那么就需要使用@Param(Constants.WRAPPER)设置名称。Constants.WRAPPER常量值就是ew
     * @return
     */
    @Select("select dish.*,category.name as categoryName from dish left outer join category on dish.category_id=category.id ${ew.customSqlSegment}")
    Page<DishDto> selectPage(Page<DishDto> page, Wrapper<DishDto> ew);

//    @Update("updata UPDATE dish set status = ${status} where id in (${ids})")
//    void dishStatusByStatus(List<Long> ids);
//    @Param("status") Integer stutas,
}

